package com.china.school;

 import com.china.school.dao.UserDao;
 import com.china.school.pojo.User;


 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;






 public class SpringIOCTest {

    public static   void main(String[] args) {


        //创建BeanFactory
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
//创建读取器
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
//加载配置文件
        reader.loadBeanDefinitions("bean.xml");
//获取Bean实例对象
        User user3 = (User) beanFactory.getBean("user");
        System.out.println(user3);
    }

}
